#ifndef _QTFEDITOR_H_
#define _QTFEDITOR_H_

#include <QtGui/QWidget>
#include <QtCore/QFile>
#include "QHistogram.h"
#include "QTFPanel.h"
#include "QTFColorMap.h"
#include "QColorPicker.h"
//#include "MTRand.h"
#include "histogram.h"

class Histogram;
class QTFEditor : public QWidget
{
	Q_OBJECT
public:
	QTFEditor(int transferWidth=512, QWidget *parent=0);
	~QTFEditor();
	
	int				getTFColorMapResolution(){ return m_tfPanel->getTFColorMapResolution();}
	float*			getTFColorMap(){return m_tfPanel->getTFColorMap();}
	Histogram*		getHistogram() { return m_histogramData; }
	QHistogram*		getQHistogram() { return m_histogramPanel; }
	QTFPanel*		getTFPanel() { return m_tfPanel; }
	QTFColorMap*	getColorMap() { return m_tfColorMapPanel; }
	QColorPicker*	getColorPicker() { return m_colorPicker; }
	void			incrementHistogram(double);
	void			setHistogramMinMax(double, double);
	void			setHistogram(Histogram*);
	QFile&			saveSettings(QFile&);
	QFile&			loadSettings(QFile&);

protected:
	//QSize	minimumSizeHint();
private:
	void	initLayout(int);
	void	readDefaultSettings();
	void	writeDefaultSettings();
	QHistogram		*m_histogramPanel;
	QTFPanel		*m_tfPanel;
	QTFColorMap		*m_tfColorMapPanel;
	QColorPicker	*m_colorPicker;
	
	Histogram		*m_histogramData;
	QSize			m_tfEditorSize;
	QSize			m_histogramPanelSize,m_tfPanelSize,m_tfColorMapPanelSize,m_colorPickerSize;
//	MTRand			m_randGenerator;
protected slots:
	void	changeTickColor(int);
	void	changedTFColorMap();
};

#endif

